home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk71
/
strip
/
strip.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
5KB
|
110 lines
***** STRIP *****
You do not need to read this doc to use STRIP, or at least
I wouldn't think so. To use it, just type STRIP at the Command Line
by itself and you will be given the format. R removes carriage returns
from the data file, A adds carriage returns to the data file before every
linefeed, and S strips the leading spaces from the left most part of the
data file (in effect removing the left margin).
Stripping the spaces option removes all spaces after a line feed
until it hits a non-space character. If you really want to mess up
someones mind, give them your C source with the leading spaces stripped
off....they'll never understand it!
******* The details for those that are interested *******
Another FILTER program? No not really <grin!>. Many of our
authors of P.D. software use word processors to write the documentation
for their programs, probably because programmers are such terrible
spellers and most of these word processors have spell checkers. Anyway,
when they are done they tell the system to print an image of this
document to disk. That's OK except it prints it with the left margin.
This left margin causes (in some cases) the text to print to
the screen so that there is 'wrap' to the next line. So in effect
what you get is three or four words that always drop to the next line
making reading difficult. At least its difficult for me, maybe I'm
weird.
So as long as I was writing a program to strip the leading
spaces, I threw in the ability to remove or add carriage returns.
For those that do not know, the AMIGA uses only linefeeds
to start the next line, where the IBM (MS-DOS) environment uses
Carriage Returns and Linefeeds. Reading an IBM file is not really
a problem for us AMIGANS because most of our tools just ignore the
carriage return, and if they don't we just just get double line
spacing. But a file with no carriage returns causing lots of
problems for those IBMers. It's nice to be on the right side of
the fence isn't it.
To use STRIP, enter:
STRIP <inputfile> <outputfile> <option>
where 'inputfile' is the file to read, 'outputfile' is the
file that will be created. The option is either R, A, or S. R is
the option to remove all carriage returns from the data file, A is
the option to add a carriage return before every linefeed, and S is
the option to removes each space encountered after a linefeed until
a non-space character is encountered. S also strips any carriage
returns it encounters.
When using the S option, realize that every line will be
left justified (including lines that were previously centered or
indented). The S option WILL NOT strip TABs. I spent quite some
time trying to figure out why it wasn't stripping some of the
spaces, only to find out they were TABs...(maybe I should add
that option too, hmmmmmm?).
STRIP is written in Lattice C ver 4.0. As for benchmarks,
I processed 1200 lines, and the results were as follows:
RAM: to RAM: 3 seconds
RAM: to DF0: 8 seconds
DF0: to DF1: 13 seconds
DF0: to DF0: 82 seconds (Yow!)
DH0: to DH0: 6 seconds
As you can see, I don't recommend that you read and write
to the same floppie. Besides taking a long time, it's noisy as hell!
Well that's it folks.....hope it does ya some good!
Oh yeah! This software is total Public Domain. No monies
are to be charged for this software, except the standard media
transfer charges (you know, disks, phoneline charges, standard
hourly BBS rates, etc.). It belongs to me, I have the source
code to prove it, and I want anyone that can use it to have it
free of charge.
Don't send me any monies......you'd be nuts if you did!
If you have an over powering urge to spend money, take you wife
(or girlfriend) out to dinner instead (or go buy Dungeon Master.
It's a great game!). Considering this program is worth about
two bucks if I were buying it, you better make it the Golden
Arches!
I don't intend to do any updates (come on, who's kidding
who here? This is no major impact on the Amiga world!) but I am
interested in any problems you find or suggestions for additions.
I may want to add your suggestions for my own use. If I do, I'd
release the new version.
One idea I'm kicking around is adding the ability to set
the line size i.e: Read in the entire file, stripping the carriage
returns and linefeeds out, then re-write the file on a second pass
to a pre-determined line length. I don't know what I'd use it for,
I just want to see if I can do it in a tight enough loop....anyway
let me know what you think, good or bad.
Brett Lathrope,
Buena Park, CA.
GEnie: B.Lathrope